<?php

use Illuminate\Http\Request;

/*
  |--------------------------------------------------------------------------
  | API Routes
  |--------------------------------------------------------------------------
  |
  | Here is where you can register API routes for your application. These
  | routes are loaded by the RouteServiceProvider within a group which
  | is assigned the "api" middleware group. Enjoy building your API!
  |
 */

$api = app('Dingo\Api\Routing\Router');


$api->version('v1', ['namespace' => 'App\Http\Controllers\Api', 'providers' => 'jwt', 'middleware' => 'access'], function ($api) {
    $api->get('api2', function() {
        return 'api2';
    });

    $api->get('test1', "PlatformsetupController@index");
    $api->get('test2', "Seller/PlatformsetupController@index");

    $api->post('login/admin', 'AdminLoginController@login');

    $api->get('login/admin', function() {

        return 'get login/admin';
    });

    $api->group(['middleware' => 'jwt.api.auth'], function ($api) { //验证token生效
        $api->post('user', 'UsersController@user');
        $api->get('token', function() {
            return 'token 正确';
        });
    });
});
